from mido import MidiFile

from rich import print as prt


from MineMusicVisualizer.main import construct_piano_structure, DirectionCoordinate
from Musicreater import MusicSequence
from Musicreater.plugin import commands_to_structure, COMPABILITY_VERSION_121


file_path = r"C:\Eilles\程设\音创\#master\遠い空へ.mid"

# msq = MusicSequence.from_mido(MidiFile(file_path, clip=True), "Test")

struct, size, final_pos = commands_to_structure(
    construct_piano_structure(
        base_point=DirectionCoordinate(0, 0, 0),
        execute_command_header="execute as @e[type=armor_stand, name=piano] at @s run ",
    ),
    max_height=32,
    compability_version_=COMPABILITY_VERSION_121,
)
with open("piano7.mcstructure", "wb") as f:
    struct.dump(f)

prt("结构大小", size, "末点坐标", final_pos)
